//1.引入EventEmitter构造函数
const events = require("events");
const EventEmitter = events.EventEmitter;

//2.进行事件对象的实例化
let eventObj = new EventEmitter();//事件对象
//3.进行事件监听和触发
//监听
eventObj.on("hello", (args) => {
    console.log(args);
    console.log("node events");
});
//事件名随便写
eventObj.emit("hello", ["test"]);
//触发事件hello，才会输出node events
